package com.wms.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wms.entity.WStock;
import com.wms.vo.WStockInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 仓库库存表(WStock)表数据库访问层
 *
 * @author Li Xiaoyu
 * @since 2023-10-20 17:21:06
 */
@Mapper
public interface WStockDao extends BaseMapper<WStock> {
    @Select("select a.id,b.product_name,c.`name`,a.num,a.creator,a.mender,a.create_time,a.update_time\n" +
            "from w_stock a,w_product b,w_store c\n" +
            "where a.pid=b.product_id and a.sid=c.store_id")
    List<WStockInfo> selectAllStockInfo();

    @Select("select a.id,a.pid,b.product_name,c.`name`,a.num,a.creator,a.mender,a.create_time,a.update_time\n" +
            "from w_stock a,w_product b,w_store c\n" +
            "where a.sid=#{sid} and a.pid=b.product_id and a.sid=c.store_id")
    List<WStockInfo> selectBySid(Integer sid);
    @Select("SELECT * FROM w_stock where pid=#{pid} and sid=#{sid}")
    WStock selectByPidSid(Integer pid,Integer sid);

}

